home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 8969 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.6 KB  |  34 lines

  1. Path: nntp.onyx.net!claymoor
  2. From: Adam.Morris@octacon.co.uk (Adam Morris)
  3. Newsgroups: comp.lang.ada,comp.lang.c++
  4. Subject: Re: on OO differnces between Ada95 and C++
  5. Date: Tue, 27 Feb 96 22:23:40 GMT
  6. Organization: Octacon Ltd
  7. Message-ID: <4gveoa$nnd@mulgave.octacon.co.uk>
  8. References: <4gbq7q$g08@qualcomm.com> <4gdidj$10f5@watnews1.watson.ibm.com>
  9. NNTP-Posting-Host: claymoor.onyx.net
  10. X-Newsreader: News Xpress Version 1.0 Beta #4
  11.  
  12. In article <4gdidj$10f5@watnews1.watson.ibm.com>,
  13.    ncohen@watson.ibm.com (Norman H. Cohen) wrote:
  14. >In article <4gbq7q$g08@qualcomm.com>, nabbasi@qualcomm.com (Nasser Abbasi)
  15. >observes that in C and C++ one specifies an interface in a .h (or .H)
  16. >file and imports the interface with a #include directive, while in Ada
  17. >one specifies an interface with a program-unit declaration (typically a
  18. >package declaration) and imports it with a with clause.  In C and C++
  19. >importing is transitive--if B #includes A and C #includes B, then C has
  20. >effectively #included--while in Ada it is not--if B has a with clause for
  21. >A and C has a with clause for B, then A is not visible in C unless C has
  22. >its own explicit with clause for A.
  23.  
  24. Only if you do what you shouldn't do...  the .h file should have forward 
  25. declarations of all classes it uses except in certain cases.  And what are 
  26. those cases, if A inherits from B then (and only then as far as I know) should 
  27. you #include B.h in A.h  otherwise you have a declaration saying
  28. class B{};
  29.  
  30. you #include B.h in the .cc file this means that A.cc knows about B.h but C.cc 
  31. will only know about B.h if it has included A.h AND A is derived from B.
  32.  
  33. Adam.
  34.